import { createStore, combineReducers } from 'redux'

const initialState = {
  isLoggedIn: false
}

const userReducer = (state = initialState, action) => {
  switch (action.type) {
    case 'SET_LOGIN_STATUS':
      return {
        ...state,
        isLoggedIn: action.payload
      }
    default:
      return state
  }
}

const rootReducer = combineReducers({
  user: userReducer
})

export const store = createStore(rootReducer)